package com.ruoyi.web.controller.combat.camera;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.combat.domain.camera.CombatCameraGeo;
import com.ruoyi.combat.service.camera.ICombatCameraGeoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 摄像头定位信息Controller
 * 
 * @author ruoyi
 * @date 2025-01-08
 */
@Api(tags = "课题六：摄像头位置分析-摄像头定位信息")
@RestController
@RequestMapping("/camera/geo")
public class CombatCameraGeoController extends BaseController
{
    @Autowired
    private ICombatCameraGeoService combatCameraGeoService;

    /**
     * 查询摄像头定位信息列表
     */
    @ApiOperation(value = "查询摄像头定位信息列表")
    @PreAuthorize("@ss.hasPermi('system:geo:list')")
    @GetMapping("/list")
    public TableDataInfo list(CombatCameraGeo combatCameraGeo)
    {
        startPage();
        List<CombatCameraGeo> list = combatCameraGeoService.selectCombatCameraGeoList(combatCameraGeo);
        return getDataTable(list);
    }

    /**
     * 导出摄像头定位信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:geo:export')")
    @Log(title = "摄像头定位信息", businessType = BusinessType.EXPORT)
    @ApiOperation(value = "导出摄像头定位信息列表")
    @PostMapping("/export")
    public void export(HttpServletResponse response, CombatCameraGeo combatCameraGeo)
    {
        List<CombatCameraGeo> list = combatCameraGeoService.selectCombatCameraGeoList(combatCameraGeo);
        ExcelUtil<CombatCameraGeo> util = new ExcelUtil<CombatCameraGeo>(CombatCameraGeo.class);
        util.exportExcel(response, list, "摄像头定位信息数据");
    }

    /**
     * 获取摄像头定位信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:geo:query')")
    @ApiOperation(value = "获取摄像头定位信息详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(combatCameraGeoService.selectCombatCameraGeoById(id));
    }

    /**
     * 新增摄像头定位信息
     */
    @PreAuthorize("@ss.hasPermi('system:geo:add')")
    @Log(title = "摄像头定位信息", businessType = BusinessType.INSERT)
    @ApiOperation(value = "新增摄像头定位信息")
    @PostMapping
    public AjaxResult add(@RequestBody CombatCameraGeo combatCameraGeo)
    {
        return toAjax(combatCameraGeoService.insertCombatCameraGeo(combatCameraGeo));
    }

    /**
     * 修改摄像头定位信息
     */
    @PreAuthorize("@ss.hasPermi('system:geo:edit')")
    @Log(title = "摄像头定位信息", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "修改摄像头定位信息")
    @PutMapping
    public AjaxResult edit(@RequestBody CombatCameraGeo combatCameraGeo)
    {
        return toAjax(combatCameraGeoService.updateCombatCameraGeo(combatCameraGeo));
    }

    /**
     * 删除摄像头定位信息
     */
    @PreAuthorize("@ss.hasPermi('system:geo:remove')")
    @Log(title = "摄像头定位信息", businessType = BusinessType.DELETE)
    @ApiOperation(value = "删除摄像头定位信息")
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(combatCameraGeoService.deleteCombatCameraGeoByIds(ids));
    }
}
